package es.uji.viselab.benchmark.test;

import java.util.ArrayList;
import java.util.List;

import es.uji.viselab.benchmark.BMException;
import es.uji.viselab.network.Client;
import es.uji.viselab.network.DataPackage;

public class BMSimulationThread implements Runnable{

	@Override
	public void run() {
		
		Client client = new Client();
		try {
			client.connect();
			List<DataPackage> data = createData3D();
			client.encodeAndSendData(data);
		//	data = createData2D();
		//	client.encodeAndSendData(data);
		} catch (BMException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	private List<DataPackage> createData2D() {
		List<DataPackage> data = new ArrayList<DataPackage>();
        for (int i=100;i>0;i--){
        	DataPackage item = new DataPackage("ERROR",i,100-i,i*i,0);
        	data.add(item);
        }
        return data;
	}

	private List<DataPackage> createData3D() {
		List<DataPackage> data = new ArrayList<DataPackage>();
        for (int i=0;i<5;i++){
        	DataPackage item = new DataPackage("XYZ_END_EFFECTOR",i,i,i*2,i*3);
        	data.add(item);
        }
        return data;
	}	
  
}
